﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using PAT.Entities;
using PAT.Data;

#endregion

namespace PAT.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="PatTemparioProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class PatTemparioProviderBaseCore : EntityProviderBase<PAT.Entities.PatTempario, PAT.Entities.PatTemparioKey>
	{		
		#region Get from Many To Many Relationship Functions
		#region GetByIdItemInventarioFromPatItemOperacion
		
		/// <summary>
		///		Gets PAT_TEMPARIO objects from the datasource by ID_ITEM_INVENTARIO in the
		///		PAT_ITEM_OPERACION table. Table PAT_TEMPARIO is related to table PAT_ITEM_INVENTARIO
		///		through the (M:N) relationship defined in the PAT_ITEM_OPERACION table.
		/// </summary>
		/// <param name="_idItemInventario"></param>
		/// <returns>Returns a typed collection of PatTempario objects.</returns>
		public TList<PatTempario> GetByIdItemInventarioFromPatItemOperacion(System.Int32 _idItemInventario)
		{
			int count = -1;
			return GetByIdItemInventarioFromPatItemOperacion(null,_idItemInventario, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets PAT.Entities.PatTempario objects from the datasource by ID_ITEM_INVENTARIO in the
		///		PAT_ITEM_OPERACION table. Table PAT_TEMPARIO is related to table PAT_ITEM_INVENTARIO
		///		through the (M:N) relationship defined in the PAT_ITEM_OPERACION table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idItemInventario"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatTempario objects.</returns>
		public TList<PatTempario> GetByIdItemInventarioFromPatItemOperacion(System.Int32 _idItemInventario, int start, int pageLength)
		{
			int count = -1;
			return GetByIdItemInventarioFromPatItemOperacion(null, _idItemInventario, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatTempario objects from the datasource by ID_ITEM_INVENTARIO in the
		///		PAT_ITEM_OPERACION table. Table PAT_TEMPARIO is related to table PAT_ITEM_INVENTARIO
		///		through the (M:N) relationship defined in the PAT_ITEM_OPERACION table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idItemInventario"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_TEMPARIO objects.</returns>
		public TList<PatTempario> GetByIdItemInventarioFromPatItemOperacion(TransactionManager transactionManager, System.Int32 _idItemInventario)
		{
			int count = -1;
			return GetByIdItemInventarioFromPatItemOperacion(transactionManager, _idItemInventario, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets PatTempario objects from the datasource by ID_ITEM_INVENTARIO in the
		///		PAT_ITEM_OPERACION table. Table PAT_TEMPARIO is related to table PAT_ITEM_INVENTARIO
		///		through the (M:N) relationship defined in the PAT_ITEM_OPERACION table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idItemInventario"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_TEMPARIO objects.</returns>
		public TList<PatTempario> GetByIdItemInventarioFromPatItemOperacion(TransactionManager transactionManager, System.Int32 _idItemInventario,int start, int pageLength)
		{
			int count = -1;
			return GetByIdItemInventarioFromPatItemOperacion(transactionManager, _idItemInventario, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatTempario objects from the datasource by ID_ITEM_INVENTARIO in the
		///		PAT_ITEM_OPERACION table. Table PAT_TEMPARIO is related to table PAT_ITEM_INVENTARIO
		///		through the (M:N) relationship defined in the PAT_ITEM_OPERACION table.
		/// </summary>
		/// <param name="_idItemInventario"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_TEMPARIO objects.</returns>
		public TList<PatTempario> GetByIdItemInventarioFromPatItemOperacion(System.Int32 _idItemInventario,int start, int pageLength, out int count)
		{
			
			return GetByIdItemInventarioFromPatItemOperacion(null, _idItemInventario, start, pageLength, out count);
		}


		/// <summary>
		///		Gets PAT_TEMPARIO objects from the datasource by ID_ITEM_INVENTARIO in the
		///		PAT_ITEM_OPERACION table. Table PAT_TEMPARIO is related to table PAT_ITEM_INVENTARIO
		///		through the (M:N) relationship defined in the PAT_ITEM_OPERACION table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_idItemInventario"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatTempario objects.</returns>
		public abstract TList<PatTempario> GetByIdItemInventarioFromPatItemOperacion(TransactionManager transactionManager,System.Int32 _idItemInventario, int start, int pageLength, out int count);
		
		#endregion GetByIdItemInventarioFromPatItemOperacion
		
		#region GetByIdKitFromPatKitOperacion
		
		/// <summary>
		///		Gets PAT_TEMPARIO objects from the datasource by ID_KIT in the
		///		PAT_KIT_OPERACION table. Table PAT_TEMPARIO is related to table PAT_KIT
		///		through the (M:N) relationship defined in the PAT_KIT_OPERACION table.
		/// </summary>
		/// <param name="_idKit"></param>
		/// <returns>Returns a typed collection of PatTempario objects.</returns>
		public TList<PatTempario> GetByIdKitFromPatKitOperacion(System.Int32 _idKit)
		{
			int count = -1;
			return GetByIdKitFromPatKitOperacion(null,_idKit, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets PAT.Entities.PatTempario objects from the datasource by ID_KIT in the
		///		PAT_KIT_OPERACION table. Table PAT_TEMPARIO is related to table PAT_KIT
		///		through the (M:N) relationship defined in the PAT_KIT_OPERACION table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idKit"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatTempario objects.</returns>
		public TList<PatTempario> GetByIdKitFromPatKitOperacion(System.Int32 _idKit, int start, int pageLength)
		{
			int count = -1;
			return GetByIdKitFromPatKitOperacion(null, _idKit, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatTempario objects from the datasource by ID_KIT in the
		///		PAT_KIT_OPERACION table. Table PAT_TEMPARIO is related to table PAT_KIT
		///		through the (M:N) relationship defined in the PAT_KIT_OPERACION table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idKit"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_TEMPARIO objects.</returns>
		public TList<PatTempario> GetByIdKitFromPatKitOperacion(TransactionManager transactionManager, System.Int32 _idKit)
		{
			int count = -1;
			return GetByIdKitFromPatKitOperacion(transactionManager, _idKit, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets PatTempario objects from the datasource by ID_KIT in the
		///		PAT_KIT_OPERACION table. Table PAT_TEMPARIO is related to table PAT_KIT
		///		through the (M:N) relationship defined in the PAT_KIT_OPERACION table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idKit"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_TEMPARIO objects.</returns>
		public TList<PatTempario> GetByIdKitFromPatKitOperacion(TransactionManager transactionManager, System.Int32 _idKit,int start, int pageLength)
		{
			int count = -1;
			return GetByIdKitFromPatKitOperacion(transactionManager, _idKit, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatTempario objects from the datasource by ID_KIT in the
		///		PAT_KIT_OPERACION table. Table PAT_TEMPARIO is related to table PAT_KIT
		///		through the (M:N) relationship defined in the PAT_KIT_OPERACION table.
		/// </summary>
		/// <param name="_idKit"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_TEMPARIO objects.</returns>
		public TList<PatTempario> GetByIdKitFromPatKitOperacion(System.Int32 _idKit,int start, int pageLength, out int count)
		{
			
			return GetByIdKitFromPatKitOperacion(null, _idKit, start, pageLength, out count);
		}


		/// <summary>
		///		Gets PAT_TEMPARIO objects from the datasource by ID_KIT in the
		///		PAT_KIT_OPERACION table. Table PAT_TEMPARIO is related to table PAT_KIT
		///		through the (M:N) relationship defined in the PAT_KIT_OPERACION table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_idKit"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatTempario objects.</returns>
		public abstract TList<PatTempario> GetByIdKitFromPatKitOperacion(TransactionManager transactionManager,System.Int32 _idKit, int start, int pageLength, out int count);
		
		#endregion GetByIdKitFromPatKitOperacion
		
		#region GetByIdDocumentoNumeroOrdenFromPatOrdenTrabajoOperacion
		
		/// <summary>
		///		Gets PAT_TEMPARIO objects from the datasource by ID_DOCUMENTO in the
		///		PAT_ORDEN_TRABAJO_OPERACION table. Table PAT_TEMPARIO is related to table PAT_ORDEN_TRABAJO
		///		through the (M:N) relationship defined in the PAT_ORDEN_TRABAJO_OPERACION table.
		/// </summary>
		/// <param name="_idDocumento"></param>
		/// <param name="_numeroOrden"></param>
		/// <returns>Returns a typed collection of PatTempario objects.</returns>
		public TList<PatTempario> GetByIdDocumentoNumeroOrdenFromPatOrdenTrabajoOperacion(System.Int32 _idDocumento, System.Int32 _numeroOrden)
		{
			int count = -1;
			return GetByIdDocumentoNumeroOrdenFromPatOrdenTrabajoOperacion(null,_idDocumento, _numeroOrden, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets PAT.Entities.PatTempario objects from the datasource by ID_DOCUMENTO in the
		///		PAT_ORDEN_TRABAJO_OPERACION table. Table PAT_TEMPARIO is related to table PAT_ORDEN_TRABAJO
		///		through the (M:N) relationship defined in the PAT_ORDEN_TRABAJO_OPERACION table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idDocumento"></param>
		/// <param name="_numeroOrden"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatTempario objects.</returns>
		public TList<PatTempario> GetByIdDocumentoNumeroOrdenFromPatOrdenTrabajoOperacion(System.Int32 _idDocumento, System.Int32 _numeroOrden, int start, int pageLength)
		{
			int count = -1;
			return GetByIdDocumentoNumeroOrdenFromPatOrdenTrabajoOperacion(null, _idDocumento, _numeroOrden, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatTempario objects from the datasource by ID_DOCUMENTO in the
		///		PAT_ORDEN_TRABAJO_OPERACION table. Table PAT_TEMPARIO is related to table PAT_ORDEN_TRABAJO
		///		through the (M:N) relationship defined in the PAT_ORDEN_TRABAJO_OPERACION table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idDocumento"></param>
		/// <param name="_numeroOrden"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_TEMPARIO objects.</returns>
		public TList<PatTempario> GetByIdDocumentoNumeroOrdenFromPatOrdenTrabajoOperacion(TransactionManager transactionManager, System.Int32 _idDocumento, System.Int32 _numeroOrden)
		{
			int count = -1;
			return GetByIdDocumentoNumeroOrdenFromPatOrdenTrabajoOperacion(transactionManager, _idDocumento, _numeroOrden, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets PatTempario objects from the datasource by ID_DOCUMENTO in the
		///		PAT_ORDEN_TRABAJO_OPERACION table. Table PAT_TEMPARIO is related to table PAT_ORDEN_TRABAJO
		///		through the (M:N) relationship defined in the PAT_ORDEN_TRABAJO_OPERACION table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idDocumento"></param>
		/// <param name="_numeroOrden"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_TEMPARIO objects.</returns>
		public TList<PatTempario> GetByIdDocumentoNumeroOrdenFromPatOrdenTrabajoOperacion(TransactionManager transactionManager, System.Int32 _idDocumento, System.Int32 _numeroOrden,int start, int pageLength)
		{
			int count = -1;
			return GetByIdDocumentoNumeroOrdenFromPatOrdenTrabajoOperacion(transactionManager, _idDocumento, _numeroOrden, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatTempario objects from the datasource by ID_DOCUMENTO in the
		///		PAT_ORDEN_TRABAJO_OPERACION table. Table PAT_TEMPARIO is related to table PAT_ORDEN_TRABAJO
		///		through the (M:N) relationship defined in the PAT_ORDEN_TRABAJO_OPERACION table.
		/// </summary>
		/// <param name="_idDocumento"></param>
		/// <param name="_numeroOrden"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_TEMPARIO objects.</returns>
		public TList<PatTempario> GetByIdDocumentoNumeroOrdenFromPatOrdenTrabajoOperacion(System.Int32 _idDocumento, System.Int32 _numeroOrden,int start, int pageLength, out int count)
		{
			
			return GetByIdDocumentoNumeroOrdenFromPatOrdenTrabajoOperacion(null, _idDocumento, _numeroOrden, start, pageLength, out count);
		}


		/// <summary>
		///		Gets PAT_TEMPARIO objects from the datasource by ID_DOCUMENTO in the
		///		PAT_ORDEN_TRABAJO_OPERACION table. Table PAT_TEMPARIO is related to table PAT_ORDEN_TRABAJO
		///		through the (M:N) relationship defined in the PAT_ORDEN_TRABAJO_OPERACION table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_idDocumento"></param>
		/// <param name="_numeroOrden"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatTempario objects.</returns>
		public abstract TList<PatTempario> GetByIdDocumentoNumeroOrdenFromPatOrdenTrabajoOperacion(TransactionManager transactionManager,System.Int32 _idDocumento, System.Int32 _numeroOrden, int start, int pageLength, out int count);
		
		#endregion GetByIdDocumentoNumeroOrdenFromPatOrdenTrabajoOperacion
		
		#region GetByIdGrupoCatalogoFromPatTiempoTaller
		
		/// <summary>
		///		Gets PAT_TEMPARIO objects from the datasource by ID_GRUPO_CATALOGO in the
		///		PAT_TIEMPO_TALLER table. Table PAT_TEMPARIO is related to table PAT_GRUPO_CATALOGO
		///		through the (M:N) relationship defined in the PAT_TIEMPO_TALLER table.
		/// </summary>
		/// <param name="_idGrupoCatalogo"></param>
		/// <returns>Returns a typed collection of PatTempario objects.</returns>
		public TList<PatTempario> GetByIdGrupoCatalogoFromPatTiempoTaller(System.Int16 _idGrupoCatalogo)
		{
			int count = -1;
			return GetByIdGrupoCatalogoFromPatTiempoTaller(null,_idGrupoCatalogo, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets PAT.Entities.PatTempario objects from the datasource by ID_GRUPO_CATALOGO in the
		///		PAT_TIEMPO_TALLER table. Table PAT_TEMPARIO is related to table PAT_GRUPO_CATALOGO
		///		through the (M:N) relationship defined in the PAT_TIEMPO_TALLER table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idGrupoCatalogo"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatTempario objects.</returns>
		public TList<PatTempario> GetByIdGrupoCatalogoFromPatTiempoTaller(System.Int16 _idGrupoCatalogo, int start, int pageLength)
		{
			int count = -1;
			return GetByIdGrupoCatalogoFromPatTiempoTaller(null, _idGrupoCatalogo, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatTempario objects from the datasource by ID_GRUPO_CATALOGO in the
		///		PAT_TIEMPO_TALLER table. Table PAT_TEMPARIO is related to table PAT_GRUPO_CATALOGO
		///		through the (M:N) relationship defined in the PAT_TIEMPO_TALLER table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idGrupoCatalogo"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_TEMPARIO objects.</returns>
		public TList<PatTempario> GetByIdGrupoCatalogoFromPatTiempoTaller(TransactionManager transactionManager, System.Int16 _idGrupoCatalogo)
		{
			int count = -1;
			return GetByIdGrupoCatalogoFromPatTiempoTaller(transactionManager, _idGrupoCatalogo, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets PatTempario objects from the datasource by ID_GRUPO_CATALOGO in the
		///		PAT_TIEMPO_TALLER table. Table PAT_TEMPARIO is related to table PAT_GRUPO_CATALOGO
		///		through the (M:N) relationship defined in the PAT_TIEMPO_TALLER table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idGrupoCatalogo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_TEMPARIO objects.</returns>
		public TList<PatTempario> GetByIdGrupoCatalogoFromPatTiempoTaller(TransactionManager transactionManager, System.Int16 _idGrupoCatalogo,int start, int pageLength)
		{
			int count = -1;
			return GetByIdGrupoCatalogoFromPatTiempoTaller(transactionManager, _idGrupoCatalogo, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatTempario objects from the datasource by ID_GRUPO_CATALOGO in the
		///		PAT_TIEMPO_TALLER table. Table PAT_TEMPARIO is related to table PAT_GRUPO_CATALOGO
		///		through the (M:N) relationship defined in the PAT_TIEMPO_TALLER table.
		/// </summary>
		/// <param name="_idGrupoCatalogo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_TEMPARIO objects.</returns>
		public TList<PatTempario> GetByIdGrupoCatalogoFromPatTiempoTaller(System.Int16 _idGrupoCatalogo,int start, int pageLength, out int count)
		{
			
			return GetByIdGrupoCatalogoFromPatTiempoTaller(null, _idGrupoCatalogo, start, pageLength, out count);
		}


		/// <summary>
		///		Gets PAT_TEMPARIO objects from the datasource by ID_GRUPO_CATALOGO in the
		///		PAT_TIEMPO_TALLER table. Table PAT_TEMPARIO is related to table PAT_GRUPO_CATALOGO
		///		through the (M:N) relationship defined in the PAT_TIEMPO_TALLER table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_idGrupoCatalogo"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatTempario objects.</returns>
		public abstract TList<PatTempario> GetByIdGrupoCatalogoFromPatTiempoTaller(TransactionManager transactionManager,System.Int16 _idGrupoCatalogo, int start, int pageLength, out int count);
		
		#endregion GetByIdGrupoCatalogoFromPatTiempoTaller
		
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, PAT.Entities.PatTemparioKey key)
		{
			return Delete(transactionManager, key.IdOperacion);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="_idOperacion">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 _idOperacion)
		{
			return Delete(null, _idOperacion);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idOperacion">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 _idOperacion);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TEMPARIO key.
		///		FK_PAT_TEMPARIO_PAT_TEMPARIO Description: 
		/// </summary>
		/// <param name="_idProximaOperacion"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public TList<PatTempario> GetByIdProximaOperacion(System.Int32? _idProximaOperacion)
		{
			int count = -1;
			return GetByIdProximaOperacion(_idProximaOperacion, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TEMPARIO key.
		///		FK_PAT_TEMPARIO_PAT_TEMPARIO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idProximaOperacion"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		/// <remarks></remarks>
		public TList<PatTempario> GetByIdProximaOperacion(TransactionManager transactionManager, System.Int32? _idProximaOperacion)
		{
			int count = -1;
			return GetByIdProximaOperacion(transactionManager, _idProximaOperacion, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TEMPARIO key.
		///		FK_PAT_TEMPARIO_PAT_TEMPARIO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idProximaOperacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public TList<PatTempario> GetByIdProximaOperacion(TransactionManager transactionManager, System.Int32? _idProximaOperacion, int start, int pageLength)
		{
			int count = -1;
			return GetByIdProximaOperacion(transactionManager, _idProximaOperacion, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TEMPARIO key.
		///		fkPatTemparioPatTempario Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idProximaOperacion"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public TList<PatTempario> GetByIdProximaOperacion(System.Int32? _idProximaOperacion, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdProximaOperacion(null, _idProximaOperacion, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TEMPARIO key.
		///		fkPatTemparioPatTempario Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idProximaOperacion"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public TList<PatTempario> GetByIdProximaOperacion(System.Int32? _idProximaOperacion, int start, int pageLength,out int count)
		{
			return GetByIdProximaOperacion(null, _idProximaOperacion, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TEMPARIO key.
		///		FK_PAT_TEMPARIO_PAT_TEMPARIO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idProximaOperacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public abstract TList<PatTempario> GetByIdProximaOperacion(TransactionManager transactionManager, System.Int32? _idProximaOperacion, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TIPO_LIQUIDACION_TALLER key.
		///		FK_PAT_TEMPARIO_PAT_TIPO_LIQUIDACION_TALLER Description: 
		/// </summary>
		/// <param name="_idTipoLiquidacion"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public TList<PatTempario> GetByIdTipoLiquidacion(System.Byte _idTipoLiquidacion)
		{
			int count = -1;
			return GetByIdTipoLiquidacion(_idTipoLiquidacion, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TIPO_LIQUIDACION_TALLER key.
		///		FK_PAT_TEMPARIO_PAT_TIPO_LIQUIDACION_TALLER Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoLiquidacion"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		/// <remarks></remarks>
		public TList<PatTempario> GetByIdTipoLiquidacion(TransactionManager transactionManager, System.Byte _idTipoLiquidacion)
		{
			int count = -1;
			return GetByIdTipoLiquidacion(transactionManager, _idTipoLiquidacion, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TIPO_LIQUIDACION_TALLER key.
		///		FK_PAT_TEMPARIO_PAT_TIPO_LIQUIDACION_TALLER Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoLiquidacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public TList<PatTempario> GetByIdTipoLiquidacion(TransactionManager transactionManager, System.Byte _idTipoLiquidacion, int start, int pageLength)
		{
			int count = -1;
			return GetByIdTipoLiquidacion(transactionManager, _idTipoLiquidacion, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TIPO_LIQUIDACION_TALLER key.
		///		fkPatTemparioPatTipoLiquidacionTaller Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTipoLiquidacion"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public TList<PatTempario> GetByIdTipoLiquidacion(System.Byte _idTipoLiquidacion, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdTipoLiquidacion(null, _idTipoLiquidacion, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TIPO_LIQUIDACION_TALLER key.
		///		fkPatTemparioPatTipoLiquidacionTaller Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTipoLiquidacion"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public TList<PatTempario> GetByIdTipoLiquidacion(System.Byte _idTipoLiquidacion, int start, int pageLength,out int count)
		{
			return GetByIdTipoLiquidacion(null, _idTipoLiquidacion, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TIPO_LIQUIDACION_TALLER key.
		///		FK_PAT_TEMPARIO_PAT_TIPO_LIQUIDACION_TALLER Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoLiquidacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public abstract TList<PatTempario> GetByIdTipoLiquidacion(TransactionManager transactionManager, System.Byte _idTipoLiquidacion, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TIPO_OPERACION_TALLER key.
		///		FK_PAT_TEMPARIO_PAT_TIPO_OPERACION_TALLER Description: 
		/// </summary>
		/// <param name="_idTipoOperacion"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public TList<PatTempario> GetByIdTipoOperacion(System.Int16 _idTipoOperacion)
		{
			int count = -1;
			return GetByIdTipoOperacion(_idTipoOperacion, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TIPO_OPERACION_TALLER key.
		///		FK_PAT_TEMPARIO_PAT_TIPO_OPERACION_TALLER Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoOperacion"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		/// <remarks></remarks>
		public TList<PatTempario> GetByIdTipoOperacion(TransactionManager transactionManager, System.Int16 _idTipoOperacion)
		{
			int count = -1;
			return GetByIdTipoOperacion(transactionManager, _idTipoOperacion, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TIPO_OPERACION_TALLER key.
		///		FK_PAT_TEMPARIO_PAT_TIPO_OPERACION_TALLER Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoOperacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public TList<PatTempario> GetByIdTipoOperacion(TransactionManager transactionManager, System.Int16 _idTipoOperacion, int start, int pageLength)
		{
			int count = -1;
			return GetByIdTipoOperacion(transactionManager, _idTipoOperacion, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TIPO_OPERACION_TALLER key.
		///		fkPatTemparioPatTipoOperacionTaller Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTipoOperacion"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public TList<PatTempario> GetByIdTipoOperacion(System.Int16 _idTipoOperacion, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdTipoOperacion(null, _idTipoOperacion, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TIPO_OPERACION_TALLER key.
		///		fkPatTemparioPatTipoOperacionTaller Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTipoOperacion"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public TList<PatTempario> GetByIdTipoOperacion(System.Int16 _idTipoOperacion, int start, int pageLength,out int count)
		{
			return GetByIdTipoOperacion(null, _idTipoOperacion, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_TEMPARIO_PAT_TIPO_OPERACION_TALLER key.
		///		FK_PAT_TEMPARIO_PAT_TIPO_OPERACION_TALLER Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoOperacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatTempario objects.</returns>
		public abstract TList<PatTempario> GetByIdTipoOperacion(TransactionManager transactionManager, System.Int16 _idTipoOperacion, int start, int pageLength, out int count);
		
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override PAT.Entities.PatTempario Get(TransactionManager transactionManager, PAT.Entities.PatTemparioKey key, int start, int pageLength)
		{
			return GetByIdOperacion(transactionManager, key.IdOperacion, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_PAT_TEMPARIO index.
		/// </summary>
		/// <param name="_idOperacion"></param>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatTempario"/> class.</returns>
		public PAT.Entities.PatTempario GetByIdOperacion(System.Int32 _idOperacion)
		{
			int count = -1;
			return GetByIdOperacion(null,_idOperacion, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_TEMPARIO index.
		/// </summary>
		/// <param name="_idOperacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatTempario"/> class.</returns>
		public PAT.Entities.PatTempario GetByIdOperacion(System.Int32 _idOperacion, int start, int pageLength)
		{
			int count = -1;
			return GetByIdOperacion(null, _idOperacion, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_TEMPARIO index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idOperacion"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatTempario"/> class.</returns>
		public PAT.Entities.PatTempario GetByIdOperacion(TransactionManager transactionManager, System.Int32 _idOperacion)
		{
			int count = -1;
			return GetByIdOperacion(transactionManager, _idOperacion, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_TEMPARIO index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idOperacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatTempario"/> class.</returns>
		public PAT.Entities.PatTempario GetByIdOperacion(TransactionManager transactionManager, System.Int32 _idOperacion, int start, int pageLength)
		{
			int count = -1;
			return GetByIdOperacion(transactionManager, _idOperacion, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_TEMPARIO index.
		/// </summary>
		/// <param name="_idOperacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatTempario"/> class.</returns>
		public PAT.Entities.PatTempario GetByIdOperacion(System.Int32 _idOperacion, int start, int pageLength, out int count)
		{
			return GetByIdOperacion(null, _idOperacion, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_TEMPARIO index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idOperacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatTempario"/> class.</returns>
		public abstract PAT.Entities.PatTempario GetByIdOperacion(TransactionManager transactionManager, System.Int32 _idOperacion, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a TList&lt;PatTempario&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="TList&lt;PatTempario&gt;"/></returns>
		public static TList<PatTempario> Fill(IDataReader reader, TList<PatTempario> rows, int start, int pageLength)
		{
			NetTiersProvider currentProvider = DataRepository.Provider;
            bool useEntityFactory = currentProvider.UseEntityFactory;
            bool enableEntityTracking = currentProvider.EnableEntityTracking;
            LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy;
			Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType;
			
			// advance to the starting row
			for (int i = 0; i < start; i++)
			{
				if (!reader.Read())
				return rows; // not enough rows, just return
			}
			for (int i = 0; i < pageLength; i++)
			{
				if (!reader.Read())
					break; // we are done
					
				string key = null;
				
				PAT.Entities.PatTempario c = null;
				if (useEntityFactory)
				{
					key = new System.Text.StringBuilder("PatTempario")
					.Append("|").Append((System.Int32)reader[((int)PatTemparioColumn.IdOperacion - 1)]).ToString();
					c = EntityManager.LocateOrCreate<PatTempario>(
					key.ToString(), // EntityTrackingKey
					"PatTempario",  //Creational Type
					entityCreationFactoryType,  //Factory used to create entity
					enableEntityTracking); // Track this entity?
				}
				else
				{
					c = new PAT.Entities.PatTempario();
				}
				
				if (!enableEntityTracking ||
					c.EntityState == EntityState.Added ||
					(enableEntityTracking &&
					
						(
							(currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
							(currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged)
						)
					))
				{
					c.SuppressEntityEvents = true;
					c.IdOperacion = (System.Int32)reader[((int)PatTemparioColumn.IdOperacion - 1)];
					c.DescripcionOperacion = (System.String)reader[((int)PatTemparioColumn.DescripcionOperacion - 1)];
					c.FrecuenciaRepeticionOperacion = (System.Int32)reader[((int)PatTemparioColumn.FrecuenciaRepeticionOperacion - 1)];
					c.IdTipoLiquidacion = (System.Byte)reader[((int)PatTemparioColumn.IdTipoLiquidacion - 1)];
					c.IdTipoOperacion = (System.Int16)reader[((int)PatTemparioColumn.IdTipoOperacion - 1)];
					c.IdProximaOperacion = (reader.IsDBNull(((int)PatTemparioColumn.IdProximaOperacion - 1)))?null:(System.Int32?)reader[((int)PatTemparioColumn.IdProximaOperacion - 1)];
					c.ValorOperacion = (System.Decimal)reader[((int)PatTemparioColumn.ValorOperacion - 1)];
					c.ValorComision = (System.Decimal)reader[((int)PatTemparioColumn.ValorComision - 1)];
					c.ValorInternoTaller = (System.Decimal)reader[((int)PatTemparioColumn.ValorInternoTaller - 1)];
					c.ExcentaDeIva = (System.Boolean)reader[((int)PatTemparioColumn.ExcentaDeIva - 1)];
					c.OperacionGenerica = (System.Boolean)reader[((int)PatTemparioColumn.OperacionGenerica - 1)];
					c.TiempoEstandar = (System.Decimal)reader[((int)PatTemparioColumn.TiempoEstandar - 1)];
					c.Activo = (System.Boolean)reader[((int)PatTemparioColumn.Activo - 1)];
					c.EntityTrackingKey = key;
					c.AcceptChanges();
					c.SuppressEntityEvents = false;
				}
				rows.Add(c);
			}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="PAT.Entities.PatTempario"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="PAT.Entities.PatTempario"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, PAT.Entities.PatTempario entity)
		{
			if (!reader.Read()) return;
			
			entity.IdOperacion = (System.Int32)reader[((int)PatTemparioColumn.IdOperacion - 1)];
			entity.DescripcionOperacion = (System.String)reader[((int)PatTemparioColumn.DescripcionOperacion - 1)];
			entity.FrecuenciaRepeticionOperacion = (System.Int32)reader[((int)PatTemparioColumn.FrecuenciaRepeticionOperacion - 1)];
			entity.IdTipoLiquidacion = (System.Byte)reader[((int)PatTemparioColumn.IdTipoLiquidacion - 1)];
			entity.IdTipoOperacion = (System.Int16)reader[((int)PatTemparioColumn.IdTipoOperacion - 1)];
			entity.IdProximaOperacion = (reader.IsDBNull(((int)PatTemparioColumn.IdProximaOperacion - 1)))?null:(System.Int32?)reader[((int)PatTemparioColumn.IdProximaOperacion - 1)];
			entity.ValorOperacion = (System.Decimal)reader[((int)PatTemparioColumn.ValorOperacion - 1)];
			entity.ValorComision = (System.Decimal)reader[((int)PatTemparioColumn.ValorComision - 1)];
			entity.ValorInternoTaller = (System.Decimal)reader[((int)PatTemparioColumn.ValorInternoTaller - 1)];
			entity.ExcentaDeIva = (System.Boolean)reader[((int)PatTemparioColumn.ExcentaDeIva - 1)];
			entity.OperacionGenerica = (System.Boolean)reader[((int)PatTemparioColumn.OperacionGenerica - 1)];
			entity.TiempoEstandar = (System.Decimal)reader[((int)PatTemparioColumn.TiempoEstandar - 1)];
			entity.Activo = (System.Boolean)reader[((int)PatTemparioColumn.Activo - 1)];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="PAT.Entities.PatTempario"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="PAT.Entities.PatTempario"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, PAT.Entities.PatTempario entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.IdOperacion = (System.Int32)dataRow["ID_OPERACION"];
			entity.DescripcionOperacion = (System.String)dataRow["DESCRIPCION_OPERACION"];
			entity.FrecuenciaRepeticionOperacion = (System.Int32)dataRow["FRECUENCIA_REPETICION_OPERACION"];
			entity.IdTipoLiquidacion = (System.Byte)dataRow["ID_TIPO_LIQUIDACION"];
			entity.IdTipoOperacion = (System.Int16)dataRow["ID_TIPO_OPERACION"];
			entity.IdProximaOperacion = Convert.IsDBNull(dataRow["ID_PROXIMA_OPERACION"]) ? null : (System.Int32?)dataRow["ID_PROXIMA_OPERACION"];
			entity.ValorOperacion = (System.Decimal)dataRow["VALOR_OPERACION"];
			entity.ValorComision = (System.Decimal)dataRow["VALOR_COMISION"];
			entity.ValorInternoTaller = (System.Decimal)dataRow["VALOR_INTERNO_TALLER"];
			entity.ExcentaDeIva = (System.Boolean)dataRow["EXCENTA_DE_IVA"];
			entity.OperacionGenerica = (System.Boolean)dataRow["OPERACION_GENERICA"];
			entity.TiempoEstandar = (System.Decimal)dataRow["TIEMPO_ESTANDAR"];
			entity.Activo = (System.Boolean)dataRow["ACTIVO"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="PAT.Entities.PatTempario"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">PAT.Entities.PatTempario Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		public override void DeepLoad(TransactionManager transactionManager, PAT.Entities.PatTempario entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;

			#region IdProximaOperacionSource	
			if (CanDeepLoad(entity, "PatTempario|IdProximaOperacionSource", deepLoadType, innerList) 
				&& entity.IdProximaOperacionSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = (entity.IdProximaOperacion ?? (int)0);
				PatTempario tmpEntity = EntityManager.LocateEntity<PatTempario>(EntityLocator.ConstructKeyFromPkItems(typeof(PatTempario), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdProximaOperacionSource = tmpEntity;
				else
					entity.IdProximaOperacionSource = DataRepository.PatTemparioProvider.GetByIdOperacion(transactionManager, (entity.IdProximaOperacion ?? (int)0));		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdProximaOperacionSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdProximaOperacionSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatTemparioProvider.DeepLoad(transactionManager, entity.IdProximaOperacionSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdProximaOperacionSource

			#region IdTipoLiquidacionSource	
			if (CanDeepLoad(entity, "PatTipoLiquidacionTaller|IdTipoLiquidacionSource", deepLoadType, innerList) 
				&& entity.IdTipoLiquidacionSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IdTipoLiquidacion;
				PatTipoLiquidacionTaller tmpEntity = EntityManager.LocateEntity<PatTipoLiquidacionTaller>(EntityLocator.ConstructKeyFromPkItems(typeof(PatTipoLiquidacionTaller), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdTipoLiquidacionSource = tmpEntity;
				else
					entity.IdTipoLiquidacionSource = DataRepository.PatTipoLiquidacionTallerProvider.GetByIdTipoLiquidacion(transactionManager, entity.IdTipoLiquidacion);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdTipoLiquidacionSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdTipoLiquidacionSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatTipoLiquidacionTallerProvider.DeepLoad(transactionManager, entity.IdTipoLiquidacionSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdTipoLiquidacionSource

			#region IdTipoOperacionSource	
			if (CanDeepLoad(entity, "PatTipoOperacionTaller|IdTipoOperacionSource", deepLoadType, innerList) 
				&& entity.IdTipoOperacionSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IdTipoOperacion;
				PatTipoOperacionTaller tmpEntity = EntityManager.LocateEntity<PatTipoOperacionTaller>(EntityLocator.ConstructKeyFromPkItems(typeof(PatTipoOperacionTaller), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdTipoOperacionSource = tmpEntity;
				else
					entity.IdTipoOperacionSource = DataRepository.PatTipoOperacionTallerProvider.GetByIdTipoOperacion(transactionManager, entity.IdTipoOperacion);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdTipoOperacionSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdTipoOperacionSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatTipoOperacionTallerProvider.DeepLoad(transactionManager, entity.IdTipoOperacionSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdTipoOperacionSource
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetByIdOperacion methods when available
			
			#region PatItemOperacionCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatItemOperacion>|PatItemOperacionCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatItemOperacionCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatItemOperacionCollection = DataRepository.PatItemOperacionProvider.GetByIdOperacion(transactionManager, entity.IdOperacion);

				if (deep && entity.PatItemOperacionCollection.Count > 0)
				{
					deepHandles.Add("PatItemOperacionCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatItemOperacion>) DataRepository.PatItemOperacionProvider.DeepLoad,
						new object[] { transactionManager, entity.PatItemOperacionCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region PatKitOperacionCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatKitOperacion>|PatKitOperacionCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatKitOperacionCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatKitOperacionCollection = DataRepository.PatKitOperacionProvider.GetByIdOperacion(transactionManager, entity.IdOperacion);

				if (deep && entity.PatKitOperacionCollection.Count > 0)
				{
					deepHandles.Add("PatKitOperacionCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatKitOperacion>) DataRepository.PatKitOperacionProvider.DeepLoad,
						new object[] { transactionManager, entity.PatKitOperacionCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region PatTiempoTallerCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatTiempoTaller>|PatTiempoTallerCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatTiempoTallerCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatTiempoTallerCollection = DataRepository.PatTiempoTallerProvider.GetByIdOperacion(transactionManager, entity.IdOperacion);

				if (deep && entity.PatTiempoTallerCollection.Count > 0)
				{
					deepHandles.Add("PatTiempoTallerCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatTiempoTaller>) DataRepository.PatTiempoTallerProvider.DeepLoad,
						new object[] { transactionManager, entity.PatTiempoTallerCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region PatTemparioCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatTempario>|PatTemparioCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatTemparioCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatTemparioCollection = DataRepository.PatTemparioProvider.GetByIdProximaOperacion(transactionManager, entity.IdOperacion);

				if (deep && entity.PatTemparioCollection.Count > 0)
				{
					deepHandles.Add("PatTemparioCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatTempario>) DataRepository.PatTemparioProvider.DeepLoad,
						new object[] { transactionManager, entity.PatTemparioCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<PatGrupoCatalogo>|IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller", deepLoadType, innerList))
			{
				entity.IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller = DataRepository.PatGrupoCatalogoProvider.GetByIdOperacionFromPatTiempoTaller(transactionManager, entity.IdOperacion);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller != null)
				{
					deepHandles.Add("IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< PatGrupoCatalogo >) DataRepository.PatGrupoCatalogoProvider.DeepLoad,
						new object[] { transactionManager, entity.IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region PatOrdenTrabajoOperacionCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatOrdenTrabajoOperacion>|PatOrdenTrabajoOperacionCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatOrdenTrabajoOperacionCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatOrdenTrabajoOperacionCollection = DataRepository.PatOrdenTrabajoOperacionProvider.GetByIdOperacion(transactionManager, entity.IdOperacion);

				if (deep && entity.PatOrdenTrabajoOperacionCollection.Count > 0)
				{
					deepHandles.Add("PatOrdenTrabajoOperacionCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatOrdenTrabajoOperacion>) DataRepository.PatOrdenTrabajoOperacionProvider.DeepLoad,
						new object[] { transactionManager, entity.PatOrdenTrabajoOperacionCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<PatItemInventario>|IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion", deepLoadType, innerList))
			{
				entity.IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion = DataRepository.PatItemInventarioProvider.GetByIdOperacionFromPatItemOperacion(transactionManager, entity.IdOperacion);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion != null)
				{
					deepHandles.Add("IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< PatItemInventario >) DataRepository.PatItemInventarioProvider.DeepLoad,
						new object[] { transactionManager, entity.IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<PatOrdenTrabajo>|IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion", deepLoadType, innerList))
			{
				entity.IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion = DataRepository.PatOrdenTrabajoProvider.GetByIdOperacionFromPatOrdenTrabajoOperacion(transactionManager, entity.IdOperacion);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion != null)
				{
					deepHandles.Add("IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< PatOrdenTrabajo >) DataRepository.PatOrdenTrabajoProvider.DeepLoad,
						new object[] { transactionManager, entity.IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region IdKitPatKitCollection_From_PatKitOperacion
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<PatKit>|IdKitPatKitCollection_From_PatKitOperacion", deepLoadType, innerList))
			{
				entity.IdKitPatKitCollection_From_PatKitOperacion = DataRepository.PatKitProvider.GetByIdOperacionFromPatKitOperacion(transactionManager, entity.IdOperacion);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdKitPatKitCollection_From_PatKitOperacion' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdKitPatKitCollection_From_PatKitOperacion != null)
				{
					deepHandles.Add("IdKitPatKitCollection_From_PatKitOperacion",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< PatKit >) DataRepository.PatKitProvider.DeepLoad,
						new object[] { transactionManager, entity.IdKitPatKitCollection_From_PatKitOperacion, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the PAT.Entities.PatTempario object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">PAT.Entities.PatTempario instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">PAT.Entities.PatTempario Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		public override bool DeepSave(TransactionManager transactionManager, PAT.Entities.PatTempario entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			
			#region IdProximaOperacionSource
			if (CanDeepSave(entity, "PatTempario|IdProximaOperacionSource", deepSaveType, innerList) 
				&& entity.IdProximaOperacionSource != null)
			{
				DataRepository.PatTemparioProvider.Save(transactionManager, entity.IdProximaOperacionSource);
				entity.IdProximaOperacion = entity.IdProximaOperacionSource.IdOperacion;
			}
			#endregion 
			
			#region IdTipoLiquidacionSource
			if (CanDeepSave(entity, "PatTipoLiquidacionTaller|IdTipoLiquidacionSource", deepSaveType, innerList) 
				&& entity.IdTipoLiquidacionSource != null)
			{
				DataRepository.PatTipoLiquidacionTallerProvider.Save(transactionManager, entity.IdTipoLiquidacionSource);
				entity.IdTipoLiquidacion = entity.IdTipoLiquidacionSource.IdTipoLiquidacion;
			}
			#endregion 
			
			#region IdTipoOperacionSource
			if (CanDeepSave(entity, "PatTipoOperacionTaller|IdTipoOperacionSource", deepSaveType, innerList) 
				&& entity.IdTipoOperacionSource != null)
			{
				DataRepository.PatTipoOperacionTallerProvider.Save(transactionManager, entity.IdTipoOperacionSource);
				entity.IdTipoOperacion = entity.IdTipoOperacionSource.IdTipoOperacion;
			}
			#endregion 
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();

			#region IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller>
			if (CanDeepSave(entity.IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller, "List<PatGrupoCatalogo>|IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller", deepSaveType, innerList))
			{
				if (entity.IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller.Count > 0 || entity.IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller.DeletedItems.Count > 0)
				{
					DataRepository.PatGrupoCatalogoProvider.Save(transactionManager, entity.IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller); 
					deepHandles.Add("IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<PatGrupoCatalogo>) DataRepository.PatGrupoCatalogoProvider.DeepSave,
						new object[] { transactionManager, entity.IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 

			#region IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion>
			if (CanDeepSave(entity.IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion, "List<PatItemInventario>|IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion", deepSaveType, innerList))
			{
				if (entity.IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion.Count > 0 || entity.IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion.DeletedItems.Count > 0)
				{
					DataRepository.PatItemInventarioProvider.Save(transactionManager, entity.IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion); 
					deepHandles.Add("IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<PatItemInventario>) DataRepository.PatItemInventarioProvider.DeepSave,
						new object[] { transactionManager, entity.IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 

			#region IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion>
			if (CanDeepSave(entity.IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion, "List<PatOrdenTrabajo>|IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion", deepSaveType, innerList))
			{
				if (entity.IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion.Count > 0 || entity.IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion.DeletedItems.Count > 0)
				{
					DataRepository.PatOrdenTrabajoProvider.Save(transactionManager, entity.IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion); 
					deepHandles.Add("IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<PatOrdenTrabajo>) DataRepository.PatOrdenTrabajoProvider.DeepSave,
						new object[] { transactionManager, entity.IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 

			#region IdKitPatKitCollection_From_PatKitOperacion>
			if (CanDeepSave(entity.IdKitPatKitCollection_From_PatKitOperacion, "List<PatKit>|IdKitPatKitCollection_From_PatKitOperacion", deepSaveType, innerList))
			{
				if (entity.IdKitPatKitCollection_From_PatKitOperacion.Count > 0 || entity.IdKitPatKitCollection_From_PatKitOperacion.DeletedItems.Count > 0)
				{
					DataRepository.PatKitProvider.Save(transactionManager, entity.IdKitPatKitCollection_From_PatKitOperacion); 
					deepHandles.Add("IdKitPatKitCollection_From_PatKitOperacion",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<PatKit>) DataRepository.PatKitProvider.DeepSave,
						new object[] { transactionManager, entity.IdKitPatKitCollection_From_PatKitOperacion, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 
	
			#region List<PatItemOperacion>
				if (CanDeepSave(entity.PatItemOperacionCollection, "List<PatItemOperacion>|PatItemOperacionCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatItemOperacion child in entity.PatItemOperacionCollection)
					{
						if(child.IdOperacionSource != null)
						{
								child.IdOperacion = child.IdOperacionSource.IdOperacion;
						}

						if(child.IdItemInventarioSource != null)
						{
								child.IdItemInventario = child.IdItemInventarioSource.IdItemInventario;
						}

					}

					if (entity.PatItemOperacionCollection.Count > 0 || entity.PatItemOperacionCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatItemOperacionProvider.Save(transactionManager, entity.PatItemOperacionCollection);
						
						deepHandles.Add("PatItemOperacionCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatItemOperacion >) DataRepository.PatItemOperacionProvider.DeepSave,
							new object[] { transactionManager, entity.PatItemOperacionCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<PatKitOperacion>
				if (CanDeepSave(entity.PatKitOperacionCollection, "List<PatKitOperacion>|PatKitOperacionCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatKitOperacion child in entity.PatKitOperacionCollection)
					{
						if(child.IdOperacionSource != null)
						{
								child.IdOperacion = child.IdOperacionSource.IdOperacion;
						}

						if(child.IdKitSource != null)
						{
								child.IdKit = child.IdKitSource.IdKit;
						}

					}

					if (entity.PatKitOperacionCollection.Count > 0 || entity.PatKitOperacionCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatKitOperacionProvider.Save(transactionManager, entity.PatKitOperacionCollection);
						
						deepHandles.Add("PatKitOperacionCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatKitOperacion >) DataRepository.PatKitOperacionProvider.DeepSave,
							new object[] { transactionManager, entity.PatKitOperacionCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<PatTiempoTaller>
				if (CanDeepSave(entity.PatTiempoTallerCollection, "List<PatTiempoTaller>|PatTiempoTallerCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatTiempoTaller child in entity.PatTiempoTallerCollection)
					{
						if(child.IdOperacionSource != null)
						{
								child.IdOperacion = child.IdOperacionSource.IdOperacion;
						}

						if(child.IdGrupoCatalogoSource != null)
						{
								child.IdGrupoCatalogo = child.IdGrupoCatalogoSource.IdGrupoCatalogo;
						}

					}

					if (entity.PatTiempoTallerCollection.Count > 0 || entity.PatTiempoTallerCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatTiempoTallerProvider.Save(transactionManager, entity.PatTiempoTallerCollection);
						
						deepHandles.Add("PatTiempoTallerCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatTiempoTaller >) DataRepository.PatTiempoTallerProvider.DeepSave,
							new object[] { transactionManager, entity.PatTiempoTallerCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<PatTempario>
				if (CanDeepSave(entity.PatTemparioCollection, "List<PatTempario>|PatTemparioCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatTempario child in entity.PatTemparioCollection)
					{
						if(child.IdProximaOperacionSource != null)
						{
							child.IdProximaOperacion = child.IdProximaOperacionSource.IdOperacion;
						}
						else
						{
							child.IdProximaOperacion = entity.IdOperacion;
						}

					}

					if (entity.PatTemparioCollection.Count > 0 || entity.PatTemparioCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatTemparioProvider.Save(transactionManager, entity.PatTemparioCollection);
						
						deepHandles.Add("PatTemparioCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatTempario >) DataRepository.PatTemparioProvider.DeepSave,
							new object[] { transactionManager, entity.PatTemparioCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<PatOrdenTrabajoOperacion>
				if (CanDeepSave(entity.PatOrdenTrabajoOperacionCollection, "List<PatOrdenTrabajoOperacion>|PatOrdenTrabajoOperacionCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatOrdenTrabajoOperacion child in entity.PatOrdenTrabajoOperacionCollection)
					{
						if(child.IdOperacionSource != null)
						{
								child.IdOperacion = child.IdOperacionSource.IdOperacion;
						}

						if(child.IdDocumentoNumeroOrdenSource != null)
						{
								child.IdDocumento = child.IdDocumentoNumeroOrdenSource.IdDocumento;
								child.NumeroOrden = child.IdDocumentoNumeroOrdenSource.NumeroOrden;
						}

					}

					if (entity.PatOrdenTrabajoOperacionCollection.Count > 0 || entity.PatOrdenTrabajoOperacionCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatOrdenTrabajoOperacionProvider.Save(transactionManager, entity.PatOrdenTrabajoOperacionCollection);
						
						deepHandles.Add("PatOrdenTrabajoOperacionCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatOrdenTrabajoOperacion >) DataRepository.PatOrdenTrabajoOperacionProvider.DeepSave,
							new object[] { transactionManager, entity.PatOrdenTrabajoOperacionCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region PatTemparioChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>PAT.Entities.PatTempario</c>
	///</summary>
	public enum PatTemparioChildEntityTypes
	{
		
		///<summary>
		/// Composite Property for <c>PatTempario</c> at IdProximaOperacionSource
		///</summary>
		[ChildEntityType(typeof(PatTempario))]
		PatTempario,
			
		///<summary>
		/// Composite Property for <c>PatTipoLiquidacionTaller</c> at IdTipoLiquidacionSource
		///</summary>
		[ChildEntityType(typeof(PatTipoLiquidacionTaller))]
		PatTipoLiquidacionTaller,
			
		///<summary>
		/// Composite Property for <c>PatTipoOperacionTaller</c> at IdTipoOperacionSource
		///</summary>
		[ChildEntityType(typeof(PatTipoOperacionTaller))]
		PatTipoOperacionTaller,
	
		///<summary>
		/// Collection of <c>PatTempario</c> as OneToMany for PatItemOperacionCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatItemOperacion>))]
		PatItemOperacionCollection,

		///<summary>
		/// Collection of <c>PatTempario</c> as OneToMany for PatKitOperacionCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatKitOperacion>))]
		PatKitOperacionCollection,

		///<summary>
		/// Collection of <c>PatTempario</c> as OneToMany for PatTiempoTallerCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatTiempoTaller>))]
		PatTiempoTallerCollection,

		///<summary>
		/// Collection of <c>PatTempario</c> as OneToMany for PatTemparioCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatTempario>))]
		PatTemparioCollection,

		///<summary>
		/// Collection of <c>PatTempario</c> as ManyToMany for PatGrupoCatalogoCollection_From_PatTiempoTaller
		///</summary>
		[ChildEntityType(typeof(TList<PatGrupoCatalogo>))]
		IdGrupoCatalogoPatGrupoCatalogoCollection_From_PatTiempoTaller,

		///<summary>
		/// Collection of <c>PatTempario</c> as OneToMany for PatOrdenTrabajoOperacionCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatOrdenTrabajoOperacion>))]
		PatOrdenTrabajoOperacionCollection,

		///<summary>
		/// Collection of <c>PatTempario</c> as ManyToMany for PatItemInventarioCollection_From_PatItemOperacion
		///</summary>
		[ChildEntityType(typeof(TList<PatItemInventario>))]
		IdItemInventarioPatItemInventarioCollection_From_PatItemOperacion,

		///<summary>
		/// Collection of <c>PatTempario</c> as ManyToMany for PatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion
		///</summary>
		[ChildEntityType(typeof(TList<PatOrdenTrabajo>))]
		IdDocumentoNumeroOrdenPatOrdenTrabajoCollection_From_PatOrdenTrabajoOperacion,

		///<summary>
		/// Collection of <c>PatTempario</c> as ManyToMany for PatKitCollection_From_PatKitOperacion
		///</summary>
		[ChildEntityType(typeof(TList<PatKit>))]
		IdKitPatKitCollection_From_PatKitOperacion,
	}
	
	#endregion PatTemparioChildEntityTypes
	
	#region PatTemparioFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;PatTemparioColumn&gt;"/> class
	/// that is used exclusively with a <see cref="PatTempario"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class PatTemparioFilterBuilder : SqlFilterBuilder<PatTemparioColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PatTemparioFilterBuilder class.
		/// </summary>
		public PatTemparioFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the PatTemparioFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public PatTemparioFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the PatTemparioFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public PatTemparioFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion PatTemparioFilterBuilder
	
	#region PatTemparioParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;PatTemparioColumn&gt;"/> class
	/// that is used exclusively with a <see cref="PatTempario"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class PatTemparioParameterBuilder : ParameterizedSqlFilterBuilder<PatTemparioColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PatTemparioParameterBuilder class.
		/// </summary>
		public PatTemparioParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the PatTemparioParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public PatTemparioParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the PatTemparioParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public PatTemparioParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion PatTemparioParameterBuilder
	
	#region PatTemparioSortBuilder
    
    /// <summary>
    /// A strongly-typed instance of the <see cref="SqlSortBuilder&lt;PatTemparioColumn&gt;"/> class
	/// that is used exclusively with a <see cref="PatTempario"/> object.
    /// </summary>
    [CLSCompliant(true)]
    public class PatTemparioSortBuilder : SqlSortBuilder<PatTemparioColumn>
    {
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PatTemparioSqlSortBuilder class.
		/// </summary>
		public PatTemparioSortBuilder() : base() { }

		#endregion Constructors

    }    
    #endregion PatTemparioSortBuilder
	
} // end namespace
